package com.itbaizhan.test.exercise;

/**
 * 构造方法重载
 */
public class User {
    int id;
    String name;
    String pwd;

    //无参
    public User(){};

    public User(int id){
        //this是用来初始化属性
        this.id=id;
    }
    public User(int id,String name){
        this.id = id;
        this.name = name;
    }

    public User(int id, String name, String pwd) {
        this.id = id;
        this.name = name;
        this.pwd = pwd;
    }

    public static void main(String[] args) {
        User u = new User();//无参
        User u1 = new User(10);
        User u2 = new User(11,"jack");
        User u3 = new User(12,"good","123");
    }
}
